#ifndef __IM_ADDRESS_H__
#define __IM_ADDRESS_H__

#include <im_object.h>

/**
 * @defgroup IMAddress
 * @ingroup PrivateIMBusIME
 * @{
 */

/** @struct IMAddress
 *  @brief Interface class of a IM-BUS server/client address.
 *
 *  The purpose of IMAddress is to manipulate an address of a IM-BUS server or
 *  client.
 */

IM_BEGIN_DECLS

#define IM_ADDRESS(p)             (IM_TYPE_INSTANCE_CHECK_CAST((p),IM_TYPE_ADDRESS,IMAddress))
#define IM_CONST_ADDRESS(p)       (IM_TYPE_INSTANCE_CHECK_CAST_CONST((p),IM_TYPE_ADDRESS,IMAddress))
#define IM_ADDRESS_CLASS(c)       (IM_TYPE_CLASS_CHECK_CAST((c),IM_TYPE_ADDRESS,IMAddressClass))
#define IM_IS_ADDRESS(p)          (IM_TYPE_INSTANCE_CHECK_TYPE((p),IM_TYPE_ADDRESS))
#define IM_IS_ADDRESS_CLASS(c)    (IM_TYPE_CLASS_CHECK_TYPE((c),IM_TYPE_ADDRESS))
#define IM_ADDRESS_GET_CLASS(p)   (IM_TYPE_INSTANCE_GET_CLASS_CAST((p),IM_TYPE_ADDRESS,IMAddressClass))

typedef struct _IMAddress                    IMAddress;
typedef struct _IMAddressClass               IMAddressClass;

struct _IMAddress
{
    IMObject object;
};

struct _IMAddressClass
{
    IMObjectClass parent_class;
    IMBool      (*set)                      (IMAddress          *address,
                                             const char         *addr_string);
    const char* (*get)                      (const IMAddress    *address);
    const char* (*get_type_name)            (const IMAddress    *address);

    IMBool      (*valid)                    (const IMAddress    *address);
};

/**
 * @brief Create a new IMAddress object from an address string.
 *
 * The newly created IMAddress object is a floating object, creator
 * should call im_object_ref() to assume its ownership.
 */
IMAddress*  im_address_new                  (const char         *addr_string);

/**
 * @brief Set the value of a IMAddress object from an address string.
 */
IMBool      im_address_set                  (IMAddress          *address,
                                             const char         *addr_string);

/**
 * @brief Get the string value of a IMAddress object.
 */
const char* im_address_get                  (const IMAddress    *address);

/**
 * @brief Get type name of a IMAddress object.
 *
 * The type name is defined in platform specific implementation.
 */
const char* im_address_get_type_name        (const IMAddress    *address);

/**
 * @brief Check if a IMAddress object is valid.
 */
IMBool      im_address_valid                (const IMAddress    *address);

IM_END_DECLS

#endif
/**  @} */

/*
vi:ts=4:nowrap:ai:expandtab
*/
